package cn.varton.jdk;

import java.util.Observable;
import java.util.Observer;

public class TemperatureObserver implements Observer{
    private Observable observable;


    public TemperatureObserver(Observable observable) {
        this.observable = observable;
        this.observable.addObserver(this);
    }
    @Override
    public void update(Observable o, Object arg) {
        Temperature t = (Temperature) o;
        System.out.println("变化后的气温是："+t.getValue());
    }
}
